import upload from '@/utils/upload'
import request from '@/utils/request'

// 获取通知列表
export function getNoticList() {
    const data = {
        pageNum: 1,
        pageSize: 5,
    }
    return request({
        url: '/system/notice/list',
        method: 'get',
        params: data
    })
}

//获取所有列表
export function getAllNoticList(data) {
    return request({
        url: '/system/notice/list',
        method: 'get',
        params: data
    })
}

//获取模板列表
export function getAllTempList(data) {
    return request({
        url: '/system/tempmain/list',
        method: 'get',
        params: data
    })
}

// 终止实验
export function shatDownSy(id) {
    return request({
        url: "/system/studmain/shatDownSy",
        method: "post",
        data: {id:id}
    });
}

// 新增补充
export function addBCAPI(addForm) {
    return request({
        url: "/system/supplementary",
        method: "post",
        data: addForm
    });
}

//查看安全制度
export function getAllAqzdList(data) {
    return request({
        url: '/system/safetySystemManagement/list',
        method: 'get',
        params: data
    })
}

//查看留言
export function getAllLyList(data) {
    return request({
        url: '/system/messageManagement/list',
        method: 'get',
        params: data
    })
}

//开始实验
export function startLabor(id) {
    return request({
        url: "/system/studmain/startLabor/"+id,
        method: 'get',
    })
}

export function deleteAPI(id) {
    return request({
        url: "/system/studmain/"+id,
        method: "delete",
    });
}

//查看仪器使用规定
export function getAllYqsygdList(data) {
    return request({
        url: '/system/equipmentManagement/list',
        method: 'get',
        params: data
    })
}


//根据id查询模板
export function getTempById(id) {
    return request({
        url: '/system/tempmain/'+id,
        method: 'get'
    })
}

// 编辑实验
export function editAPI(editForm) {
    return request({
        url: "/system/studmain",
        method: "put",
        data: editForm
    });
}

// 保存实验
export function saveSyAPI(editForm) {
    return request({
        url: "/system/studmain/saveSy",
        method: "put",
        data: editForm
    });
}

//根据id查询实验
export function getLaborById(id) {
    return request({
        url: '/system/studmain/'+id,
        method: 'get'
    })
}

// 完成步骤
export function compStep(obj) {
    return request({
        url: "/system/side/compStep",
        method: "post",
        data: obj
    });
}

// 检验是否还有步骤没完成
export function isHaveNotComp(id) {
    return request({
        url: "/system/studmain/isHaveNotComp",
        method: "post",
        data: {id:id}
    });
}

// 完成实验
export function compSy(id) {
    return request({
        url: "/system/studmain/compSy",
        method: "post",
        data: {id:id}
    });
}

//新增实验
export function addLaborAPI(addForm) {
    return request({
        url: '/system/studmain',
        method: 'post',
        data: addForm
    })
}

//获取自己的实验列表
export function getAllMyLabor(query) {
    return request({
        url: '/system/studmain/list',
        method: 'get',
        params: query
    })
}

// 新增留言
export function addLYAPI(addForm) {
    return request({
        url: '/system/messageManagement',
        method: 'post',
        data: addForm
    })
}

// // 查询用户个人信息
// export function getUserProfile() {
//     return request({
//         url: '/system/user/profile',
//         method: 'get'
//     })
// }
//
// // 修改用户个人信息
// export function updateUserProfile(data) {
//     return request({
//         url: '/system/user/profile',
//         method: 'put',
//         data: data
//     })
// }
//
// // 用户头像上传
// export function uploadAvatar(data) {
//     return upload({
//         url: '/system/user/profile/avatar',
//         name: data.name,
//         filePath: data.filePath
//     })
// }
